package com.excel.write.base.impl;

import com.excel.write.base.BaseExcelWrite;
import org.apache.poi.ss.usermodel.Workbook;

import java.io.OutputStream;

/**
 * 输出到输出流，文件下载
 */
public class ExcelWriteOutputStream extends BaseExcelWrite {

    private OutputStream outputStream;

    public ExcelWriteOutputStream(OutputStream outputStream) {
        super(".xls");
        this.outputStream = outputStream;
    }


    @Override
    protected void write(Workbook workbook) {
        try {
            workbook.write(outputStream);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
